/*
 * lib2Desa - Another 2D game library in C++
 * Copyright (C) 2009 Erivaldo Xavier de Lima Filho
 *
 * This program is free software and is distributed under GNU General Public License version 3. You can modify and/or redistribute
 * it under the terms of GPL version 3 or posterior version. This program comes with NO WARRANTY, for more details, see LICENSE,
 * or <http://www.gnu.org/licenses>.
 *
 * Contact info:
 *
 *	Erivaldo Xavier de Lima Filho, desadoc@gmail.com
 *
 */

#ifndef _SCENE_HPP
#define _SCENE_HPP

#include "Core/IDrawable.hpp"
#include "Core/IGraphicDevice.hpp"
#include "Core/GameObjectGroup.hpp"
#include "Core/IGameRule.hpp"

#include <list>

#ifndef _NO_NAMESPACE
namespace lib2Desa {
#endif

class Scene : public IDrawable, IRunnable
{

private:

	shared_ptr<ISprite> background;
	std::list<shared_ptr<GameObjectGroup> > groups;
	std::list<shared_ptr<IGameRule> > rules;

	void runGroups(u32 ml);
	void runRules();

public:

	Scene(void);
	~Scene(void);

	void setBackground(const shared_ptr<ISprite>& bg)
	{
		background = bg;
	}

	void addGroup(const shared_ptr<GameObjectGroup>& g);
	bool removeGroup(const shared_ptr<GameObjectGroup>& g);

	void addRule(shared_ptr<IGameRule> r);
	bool removeRule(const shared_ptr<IGameRule>& r);

	void draw(const shared_ptr<IGraphicDevice>& gd) const;
	bool run(u32 ml);
};

#ifndef _NO_NAMESPACE
}
#endif

#endif /*Scene.hpp included*/
